<template>
<div>
  <h1>登录</h1>
  <p><input type="text" v-model="form.username"></p>
  <p><input type="text" v-model="form.password"></p>
  <button @click="add">确认</button>

</div>
</template>

<script>
export default {
  name: "alogin",
  data(){
    return{
      form:{}
    }
  },
  methods:{
    add(){
      this.$axios.post('users/Ausers_API/',this.form)
      .then(i=>{
        if (i.data.code ==200){
          alert('登录成功')
          localStorage.setItem('userid',i.data.userid)
          this.$router.push('anews/')
        }
        else {
          alert(i.data.mes)
        }

      })
    }
  },
  mounted() {
  }
}
</script>

<style scoped>

</style>
